<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateEncyclopediaArticleTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('encyclopedia_article', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('author_id')->comment('创建人');
            $table->unsignedInteger('media_id')->comment('图片id');
            $table->string('title')->comment('标题');
            $table->string('guide')->comment('指引');
            $table->unsignedInteger('category_id')->comment('分类id');
            $table->unsignedInteger('weight')->default(0)->comment('权重');
            $table->boolean('status')->default(true)->comment('状态');
            $table->timestamps();
        });

        Schema::create('encyclopedia_article_content', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('article_id');
            $table->longText('content');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('encyclopedia_article');
        Schema::dropIfExists('encyclopedia_article_content');
    }
}
